import os
import time

def clear_screen():
    os.system('clear' if os.name == 'posix' else 'cls')

def list_directory():
    for item in os.listdir('.'):
        print(item)

def echo_message(message):
    print(message)

def main():
    clear_screen()
    print("欢迎使用简单的DOS系统")
    while True:
        command = input("C:\\> ").strip().split()
        if not command:
            continue
        cmd = command[0].lower()
        args = command[1:]

        if cmd == 'dir':
            list_directory()
        elif cmd == 'cls':
            clear_screen()
        elif cmd == 'echo':
            echo_message(' '.join(args))
        elif cmd == 'exit':
            print("退出DOS系统...")
            time.sleep(1)
        elif cmd == 'quit':
            print("退出DOS系统...")
            time.sleep(1)
            break
        else:
            print(f"'{cmd}' 不是内部或外部命令，也不是可运行的程序或批处理文件。")
